
package com.senven.common.user.controller.api;



import com.senven.common.entity.Logincn;
import com.senven.common.entity.Settledlibrary;
import com.senven.common.entity.User;
import com.senven.common.user.service.LogincnService;
import com.senven.common.user.service.UserService;



import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping(value = "/user")
@Api(tags = "用户功能给微服务接口")
public class ApiUserController {
    @Autowired
    private UserService userService;
    @Autowired
    private LogincnService logincnService;


    @ApiOperation(value = "查询单个用户的信息")
    @ApiImplicitParam(name = "用户名字")
    @GetMapping(value = "/findUserByUsername")
    public User findUserByUsername(@RequestParam String username){
        return userService.findUserByUsername(username);
    }
    @ApiOperation(value = "查询单个用户的角色id")

    @GetMapping(value = "/yonghuLogin")
    public Integer yonghuLogin(@RequestParam String username){
        return userService.yonghuLogin(username);
    }
    @ApiOperation(value = "查询用户的电话")
    @GetMapping(value = "/findUserByTel")
    public User findUsernameByTel(@RequestParam String tel){
        return userService.findUserByTel(tel);
    }
    @ApiOperation(value = "新增商户")
    @PostMapping (value = "/insertShop")
    public String insertShop(@RequestBody User user){
        return userService.selectShop(user);
    }
    @ApiOperation(value = "增加登录日志")
    @PostMapping(value = "/insertLogincn")
    public Integer insertLogincn(@RequestBody Logincn logincn){
        return logincnService.insertLogincn(logincn);
    }
}
